package com.imti.mall.product.mapper;

import com.imti.mall.model.pms.pojo.PmsProductFullReduction;

import org.apache.ibatis.jdbc.SQL;

public class PmsProductFullReductionDynaSqlProvider {

    /**
     * 根据梯价表id修改满减表
     * @param pmsProductFullReduction
     * @return
     */
    public String updatePmsProductFullReduction(final PmsProductFullReduction pmsProductFullReduction){
        return new SQL(){
            {
                UPDATE(" pms_product_full_reduction ");
                if(pmsProductFullReduction!=null){
                    if (pmsProductFullReduction.getProductId() != null) {
                        SET("  product_id=#{productId}");
                    }
                    if (pmsProductFullReduction.getFullPrice() != null) {
                        SET("   full_price=#{fullPrice}");
                    }
                    if (pmsProductFullReduction.getReducePrice() != null) {
                        SET("  reduce_price=#{reducePrice}");
                    }

                }
                WHERE(" id=#{id} ");
            }

        }.toString();
    }
}
